<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<script src="../js/jquery-1.7.2.min.js"></script>
		<script src="../js/mui.min.js"></script>
		<style>
			*,
:before,
:after {
    box-sizing: border-box;
}
body {
    background: #424242;
}
form {
    width: 320px;
    margin: 45px auto;
}
form h1 {
    font-size: 3em;
    font-weight: 300;
    text-align: center;
    color: #2196F3;
}
form h5 {
    text-align: center;
    text-transform: uppercase;
    color: #c6c6c6;
}
form hr.sep {
    background: #2196F3;
    box-shadow: none;
    border: none;
    height: 2px;
    width: 25%;
    margin: 70px auto 45px auto;
}
.group {
    position: relative;
    margin: 45px 0;
}
textarea {
    resize: none;
}
input,
textarea {
    background: none;
    color: #c6c6c6;
    font-size: 18px;
    padding: 10px 10px 10px 5px;
    display: block;
    width: 320px;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid #c6c6c6;
}
input:focus,
textarea:focus {
    outline: none;
}
input:focus ~ label,
input:valid ~ label,
textarea:focus ~ label,
textarea:valid ~ label {
    top: -14px;
    font-size: 12px;
    color: #2196F3;
}
input:focus ~ .bar:before,
textarea:focus ~ .bar:before {
    width: 320px;
}
input[type="password"] {
    letter-spacing: 0.3em;
}
label {
    color: #c6c6c6;
    font-size: 16px;
    font-weight: normal;
    position: absolute;
    pointer-events: none;
    left: 5px;
    top: 10px;
    -webkit-transition: 300ms ease all;
    transition: 300ms ease all;
}
.bar {
    position: relative;
    display: block;
    width: 320px;
}
.bar:before {
    content: '';
    height: 2px;
    width: 0;
    bottom: 0px;
    position: absolute;
    background: #2196F3;
    -webkit-transition: 300ms ease all;
    transition: 300ms ease all;
    left: 0%;
}
.btn {
    background: #fff;
    color: #959595;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    text-transform: uppercase;
    text-decoration: none;
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    -webkit-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.btn:hover {
    color: #8b8b8b;
    box-shadow: 0 7px 14px rgba(0, 0, 0, 0.18), 0 5px 5px rgba(0, 0, 0, 0.12);
}
.btn.btn-link {
    background: #2196F3;
    color: #d3eafd;
}
.btn.btn-link:hover {
    background: #0d8aee;
    color: #deeffd;
}
.btn.btn-submit {
    background: #2196F3;
    color: #bce0fb;
}
.btn.btn-submit:hover {
    background: #0d8aee;
    color: #deeffd;
}
.btn.btn-cancel {
    background: #eee;
}
.btn.btn-cancel:hover {
    background: #e1e1e1;
    color: #8b8b8b;
}
.btn-box {
    text-align: center;
    margin: 50px 0;
}
		</style>
	</head>

	<body>

		<script type="text/javascript" charset="utf-8">
			mui.init()
		</script>
		<div class="mui-content" id="pullrefresh">
			<div class="wrapper">
				<form id="form">
					<h1 id="h1">请输入你的提问</h1>
					<h5 id="h5">你可以添加问题描述，以便他人能更准确的回答</h5>
					<hr class="sep" />
					<div class="group">
						<input id="qt" type="text" required="required" /><span class="highlight"></span><span class="bar"></span>
						<label>问题</label>
					</div>
					<div class="group">
						<textarea id="qd" type="textarea" rows="5" required="required"></textarea><span class="highlight"></span><span
						 class="bar"></span>
						<label>描述</label>
					</div>
					<div class="btn-box">
						<button id="check" type="submit" class="btn btn-submit">提交</button>
					</div>
				</form>
				<!-- </div>
			<form id="form">
				<div>
					<label>问题</label>
					<textarea id="qt" name="question.title" rows="2" cols="20"></textarea>
				</div>
				<div>
					<label>描述</label>
					<textarea id="qd" name="question.describe" rows="5" cols="20"></textarea>
				</div>
				<button id="check" type="submit" class="mui-btn mui-btn-primary">确认</button>
			</form>
			<div> -->

			</div>
		</div>
		<script>
			var btn = document.getElementById("check");
			//监听点击事件
			btn.addEventListener("tap", function() {
				$.ajax({
					url: window.localStorage.getItem("url") + "home/question",
					data: {
						'question.uid': window.localStorage.getItem("u_id"),
						"question.title": mui("#qt")[0].value,
						"question.describe": mui("#qd")[0].value
					},
					type: 'GET',
					dataType: 'JSON',
					contentType: "application/x-www-form-urlencoded; charset=UTF-8",

					cache: false,
					processData: true,
					success: function(data) {
						var j = JSON.stringify(data);
						var jsondata = eval('(' + j + ')');
						if (jsondata.status == "success") {
							mui.toast('提问成功！');
						} else {
							mui.toast('不知道怎么肥事，不起作用了┐(´∇｀)┌');
						}

					},
					error: function(XMLHttpRequest, textStatus, errorThrown) {
						//异常处理；
						alert(textStatus);
					}
				});
			});
		</script>
	</body>

</html>
